﻿using System.Collections.Generic;
using FacebookWrapper.ObjectModel;

namespace Desktop_Facebook
{
	internal class CSVEventSerializer : AbstractCSVSerializer
	{
		public List<Event> EventsToSave { get; set; }

		protected override List<List<string>> GetRows()
		{
			List<List<string>> rows = new List<List<string>>();

			List<string> header = new List<string>();
			header.Add("name");
			header.Add("start date");
			header.Add("start time");
			header.Add("end date");
			header.Add("end time");

			rows.Add(header);
			foreach (Event currentEvent in EventsToSave)
			{
				List<string> row = new List<string>();
				row.Add(currentEvent.Name.ToString());
				row.Add(currentEvent.StartTime.Value.Date.ToShortDateString());
				row.Add(currentEvent.StartTime.Value.ToShortTimeString());
				row.Add(currentEvent.EndTime.Value.Date.ToShortDateString());
				row.Add(currentEvent.EndTime.Value.ToShortTimeString());
				rows.Add(row);
			}

			return rows;
		}
	}
}
